package com.todo.event.activity.application.service;

import com.todo.event.activity.application.entity.bo.ActivityRecordBO;
import com.todo.event.activity.application.entity.bo.ActivityRewardRecordBO;
import com.todo.event.activity.application.entity.bo.ActivityTouchRecordBO;
import com.todo.event.activity.common.enums.EventActivityExecuteRewardEnum;
import com.todo.event.activity.common.enums.EventActivityExecuteTouchEnum;
import com.todo.event.activity.common.enums.ExecuteRecordStatusEnum;
import com.todo.event.activity.common.enums.RecordTypeEnum;

import java.util.Date;
import java.util.List;

/**
 * @author azhebuxing
 * @date 2025/1/15 15:01
 * @description
 */
public interface EventActivityRecordService {

    /**
     * 新增活动执行记录
     *
     * @param activityRecordBO
     * @return
     */
    Long insertActivityRecord(ActivityRecordBO activityRecordBO);

    /**
     * 新增活动奖励执行记录
     *
     * @param activityRewardRecordBO
     * @return
     */
    Long insertActivityRewardRecord(ActivityRewardRecordBO activityRewardRecordBO);

    /**
     * 新增活动触达执行记录
     *
     * @param activityTouchRecordBO
     * @return
     */
    Long insertActivityTouchRecord(ActivityTouchRecordBO activityTouchRecordBO);

    /**
     * 查询活动执行记录
     *
     * @param activityId
     * @param userId
     * @param uk
     * @return
     */
    ActivityRecordBO queryActivityRecord(Long activityId, Long userId, String uk);

    /**
     * 查询奖励执行记录
     *
     * @param activityId
     * @param userId
     * @param rewardEnum
     * @param uk
     * @return
     */
    ActivityRewardRecordBO queryRewardRecord(Long activityId, Long userId, EventActivityExecuteRewardEnum rewardEnum, String uk);

    /**
     * 查询触达执行记录
     *
     * @param activityId
     * @param userId
     * @param touchEnum
     * @param uk
     * @return
     */
    ActivityTouchRecordBO queryTouchRecord(Long activityId, Long userId, EventActivityExecuteTouchEnum touchEnum, String uk);

    /**
     * 查询活动执行记录列表
     *
     * @param idList
     * @return
     */
    List<ActivityRecordBO> queryActivityRecordListByIdList(List<Long> idList);

    /**
     * 查询奖励执行记录列表
     *
     * @param idList
     * @return
     */
    List<ActivityRewardRecordBO> queryRewardRecordListByIdList(List<Long> idList);

    /**
     * 查询触达执行记录列表
     *
     * @param idList
     * @return
     */
    List<ActivityTouchRecordBO> queryRewardTouchListByIdList(List<Long> idList);

    /**
     * 更新活动记录状态
     *
     * @param recordType
     * @param id
     * @param oldStatus
     * @param newStatus
     * @return
     */
    boolean updateActivityRecordStatus(RecordTypeEnum recordType, Long id, ExecuteRecordStatusEnum oldStatus, ExecuteRecordStatusEnum newStatus);

    /**
     * 根据状态和事件查询记录id列表
     *
     * @param recordType
     * @param status
     * @param startTime
     * @param endTime
     * @return
     */
    List<Long> queryStatusRecordIdListByTime(RecordTypeEnum recordType, ExecuteRecordStatusEnum status, Date startTime, Date endTime);

    /**
     * 更新活动记录基础信息
     *
     * @param recordType
     * @param recordId
     * @param propertyCode
     * @param retryCount
     * @param executeRecordStatusEnum
     * @return
     */
    boolean updateRecordBaseInfo(RecordTypeEnum recordType, Long recordId, String propertyCode, Integer retryCount, ExecuteRecordStatusEnum executeRecordStatusEnum);
}
